package com.ai.entity.server;

import com.ai.common.vaild.AddGroup;
import com.ai.common.vaild.DeleteGroup;
import com.ai.common.vaild.UpdateGroup;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.beans.BeanUtils;

import javax.validation.constraints.NotBlank;
import java.io.Serializable;

/**
 * 请求入参对象
 */
@Data
@Accessors(chain = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ServerBO implements Serializable {

    //@NotBlank(message = "修改时角色名不能空",groups = {UpdateGroup.class})

    @ApiModelProperty(value = "当前用户ID")
    private Integer currentId;

    @ApiModelProperty(value = "主键,主键ID")
    @NotBlank(message = "服务器信息更新时 服务器id 不能空，请选择有效的服务器",groups = {UpdateGroup.class})
    private String id;

    @ApiModelProperty(value = "代号（备用主键）")
    private String code;

    @ApiModelProperty(value = "服务器名")
    @NotBlank(message = "添加时服务器名不能空",groups = {AddGroup.class})
    private String nickname;

    @ApiModelProperty(value = "服务器帐号")
    private String username;

    @ApiModelProperty(value = "服务器密码")
    private String password;

    @ApiModelProperty(value = "服务器IP")
    @NotBlank(message = "添加时服务器IP不能空",groups = {AddGroup.class})
    private String ip;

    @ApiModelProperty(value = "服务器端口号")
    @NotBlank(message = "添加时服务器端口号不能空",groups = {AddGroup.class})
    private String port;

    @ApiModelProperty(value = "最大同时开启数量")
    private Integer maxNum;

    @ApiModelProperty(value = "状态(1.开，2.关，-1.弃用)")
    private Integer state;

    @ApiModelProperty(value = "部门ID")
    private Integer departmentId;


    @ApiModelProperty(value = "备注")
    private String remark;

    @ApiModelProperty(value = "音频文件存储位置")
    private String audioUrl;

    public static ServerPO convertBOToPO(ServerBO serverBO) {
        ServerPO serverPO = new ServerPO();
        BeanUtils.copyProperties(serverBO, serverPO);
        return serverPO;
    }
}
